// components/artificer_menu.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
      index:{
        type:Number,
        value:0
      }
  },

  /**
   * 组件的初始数据
   */
  data: {
    menu:[
  
    ]
  },
  
  created(){
  
    
  },
  /**
   * 组件的方法列表
   */
  methods: {
    setMenu(){
      let index = this.properties.index;
      index = index? index : 0;
      let menu= [];
        menu =[
          {img:'/images/order000.png',imged:'/images/order001.png',name:'报单大厅',selected:true,url:'/pages/order_taking/order_taking'},
          {img:'/images/ordeo1.png',imged:'/images/ordeo2.png',name:'订单管理',selected:false,url:'/pages/car_order/order/order?page_begin=artificer&type=1'},
          {img:'/images/ordero1.png',imged:'/images/ordero2.png',name:'收入数据',selected:false,url:'/pages/income_data/income_data'},
          {img:'/images/h80.png',imged:'/images/h81.png',name:'排行榜',selected:false,url:'/pages/ranking/ranking'}
        ];
        menu.map((item,key)=>{
          console.log(key,index);
          if(key == index){
            item.selected = true;
          }else{
            item.selected = false;
          }
        })
        console.log(menu)
      this.setData({
         menu:menu
      })
    },
    tabUrl(e){
      let that = this;
      let index = e.currentTarget.dataset.index;
      let url = that.data.menu[index].url;
      wx.redirectTo({
        url: url,
      })
    },
  }
})
